﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Thksoft.BusinessExpansion.Process.Test" %>

<%@ Register Src="../../UserCotrols/ProjectTreeView.ascx" TagName="Basic_TreeView" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../../Scripts/EasyUI_JS/jquery.min.js" type="text/javascript"></script>
    <script src="../../Scripts/EasyUI_JS/jquery.easyui.min.js" type="text/javascript"></script>

    <script type="text/javascript">
          <%--方法1：--%>
        var down_flag = false;
        var diffValue = 10; // 光标与单元格分割条之间的距离差值，作为判定范围
        var left_right = 0; //左侧还是右侧
        //设置Datagrid列宽可以被拖动的函数
        function SyDG_moveOnTd(td) {
            if (td.mouseDown == null || td.mouseDown == false) {
                if (event.offsetX > td.offsetWidth - 20)
                    td.style.cursor = 'w-resize';
                else
                    td.style.cursor = 'default';
            }
            if (td.mouseDown != null && td.mouseDown == true) {
                if (td.oldWidth + (event.x - td.oldX) > 0)
                    td.width = td.oldWidth + (event.x - td.oldX);
                td.style.width = td.width;
                td.style.cursor = 'w-resize';
                table = td;
                while (table.tagName != 'TABLE') table = table.parentElement;
                table.width = td.tableWidth + (td.offsetWidth - td.oldWidth); table.style.width = table.width;
            }
        }
        function SyDG_downOnTd(td) {
            if (event.offsetX > td.offsetWidth - 10) {
                // if ( Math.abs(event.x - (td.offsetleft+ td.offsetWidth) )< 10) {
                td.mouseDown = true;
                td.oldX = event.x;
                td.oldWidth = td.offsetWidth;
                table = td; while (table.tagName != 'TABLE') table = table.parentElement;
                td.tableWidth = table.offsetWidth;
            }
        }

          <%--方法1 结束--%>

        //GridView
        function GetAllCheckBox(CheckAll) {
            var items = document.getElementsByTagName("input");
            for (i = 0; i < items.length; i++) {
                if (items[i].type == "checkbox") {
                    items[i].checked = CheckAll.checked;
                }
            }
        }

        function hideOrShowTr(obj, currid_depth, beginrow) {
            var strarray = new Array();
            strarray[0] = currid_depth.split("_")[0];
            strarray[1] = currid_depth.split("_")[1];
            var beginDepth = parseInt(strarray[1]);
            var hideTr;
            if (obj.style.backgroundImage.indexOf('grid-detail-close.gif') != -1)
                hideTr = true;
            else
                hideTr = false;
            var rowcount = document.getElementById('dg1').rows.length;
            for (var i = (beginrow + 1); i < rowcount; i++) {
                var showelemid = document.getElementById('dg1').rows[i].id;
                var strarray1 = new Array();
                strarray1[0] = showelemid.split("_")[0];
                strarray1[1] = showelemid.split("_")[1];
                var endDepth = parseInt(strarray1[1]);
                if (beginDepth < endDepth) {
                    if (hideTr) {
                        document.getElementById('dg1').rows[i].style.display = "none";
                    }
                    else {
                        if (endDepth == beginDepth + 1) {
                            document.getElementById('dg1').rows[i].style.display = "";
                            var btnHideShow = document.getElementById("hideshowbtn" + strarray1[0]);
                            if (btnHideShow != null) {
                                btnHideShow.style.backgroundImage = "url(../../Images/grid/grid-detail-open.gif)";
                            }
                        }
                    }
                }
                else {
                    break;
                }
            }

            if (hideTr) {
                obj.style.backgroundImage = "url(../../Images/grid/grid-detail-open.gif)";
            }
            else {
                obj.style.backgroundImage = "url(../../Images/grid/grid-detail-close.gif)";
            }
        }
    </script>

    <style type="text/css">
        .cont_table {
            border: 1px solid #CCCCCC;
            margin: 2px 5px;
            width: 100%;
            float: left;
        }

            .cont_table th {
                background: url('../../Images/grid/header-bg.gif') repeat-x center;
                cursor: pointer;
                height: 25px;
                border: 1px solid #CCCCCC;
                line-height: 24px;
                font-family: 微软雅黑;
                font-weight: bold;
                color: Black;
                font-size: 14px;
                text-align: center;
            }

            .cont_table td {
                border: 1px dashed #CCCCCC;
                /*border-right:1px dashed #CCCCCC;*/
                text-align: center;
                line-height: 24px;
                table-layout: fixed;
            }

            .cont_table th a:link {
                text-decoration: none;
                color: Black;
            }

        table.two {
            overflow: hidden;
            table-layout: fixed;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <%--    overflow-y: scroll;--%>
        <div style="width: 80%; height: 50px;">

            <%-- AllowPaging="True" --%>
            <%--   <asp:GridView ID="dg1" runat="server">
        <Columns>

            <asp:TemplateField HeaderText="编号id">
                <ItemTemplate>
                <uc1:Basic_TreeView ID="Basic_TreeView1" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>

            <asp:BoundField  DataField="n_proid" HeaderText="编号" SortExpression="n_proid" />
            <asp:BoundField DataField="c_proname" HeaderText="名称" SortExpression="c_proname" />
            <asp:BoundField DataField="state" HeaderText="状态" SortExpression="state" />
            <asp:BoundField DataField="n_num1" HeaderText="序号1" SortExpression="n_num1" />
            <asp:BoundField DataField="n_num2" HeaderText="序号2" SortExpression="n_num2" />
            <asp:BoundField DataField="c_remark" HeaderText="备注" SortExpression="c_remark" />
            <asp:BoundField DataField="n_type" HeaderText="类型" SortExpression="n_type" />
                </Columns>
        </asp:GridView>--%>

            <asp:GridView ID="dg2" Width="100%" AutoGenerateColumns="False" EnableViewState="False" runat="server" OnRowCreated="GridView_RowCreated" BorderWidth="0" RowStyle-BackColor="#F6F6F6" CellPadding="0" CellSpacing="0" Font-Names="Verdana, Helvetica, sans-serif" Font-Size="12px" HeaderStyle-Height="25px" HeaderStyle-HorizontalAlign="center">
                <Columns>
                    <asp:TemplateField HeaderText="分类名称" HeaderStyle-CssClass="B">
                        <ItemTemplate>
                            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                <tr>
                                    <td style="height: 21px;">
                                        <%# strclass(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "id")))%>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>

                    <asp:BoundField DataField="n_proid" HeaderText="编号" SortExpression="n_proid" />

                    <asp:BoundField DataField="c_proname" HeaderText="名称" SortExpression="c_proname" />
                </Columns>
            </asp:GridView>

            <asp:GridView ID="GridView1" runat="server" CssClass="cont_table"
                AutoGenerateColumns="False" OnSorting="GridView1_Sorting"
                EmptyDataText="没有查找到您要的数据" AllowSorting="True"
                AllowPaging="True"
                OnRowDataBound="GridView1_RowDataBound"
                OnRowCreated="GridView1_RowCreated"
                OnPageIndexChanging="GridView1_PageIndexChanging">
                <Columns>

                    <asp:TemplateField>
                        <HeaderTemplate>
                            <asp:CheckBox ID="chkSelectAll" runat="server" Onclick="GetAllCheckBox(this)" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="chkSelectId" runat="server" ToolTip='<%#Eval("N_QUEUE_ID")%>' />
                        </ItemTemplate>
                    </asp:TemplateField>

                    <asp:BoundField DataField="N_QUEUE_ID" ItemStyle-Width="150" HeaderText="ID"
                        SortExpression="N_QUEUE_ID"></asp:BoundField>
                    <asp:BoundField DataField="C_PROCESS_NAME" HeaderText="流程名称" SortExpression="C_PROCESS_NAME" />
                    <asp:BoundField DataField="N_QUEUE_NUMBER" HeaderText="序号" SortExpression="N_QUEUE_NUMBER" />

                    <asp:BoundField DataField="c_node_name" HeaderText="名称" SortExpression="c_node_name" />
                </Columns>

                <PagerTemplate>
                    <uc1:Pagination ID="PageIng" runat="server" OnDataBinding="PageIng_DataBinding" Visible="true" />
                </PagerTemplate>
            </asp:GridView>

            <%--    <table id="dg" style=" width:100%;margin: 0; padding: 0">
      </table>  --%>
        </div>
    </form>
</body>
</html>